AGS_Fire

A flame plugin for Adventure Game Studio v2.7 and above

An image is worth a thousand words, etc:

On the left, a "seed" sprite for a flame. On the right, an object with a plasma flame.

To use, the following functions are available

int FireAddObject(int object, int seedSprite, int paletteSprite);

int FirePreHeat(int object);

int FireDisableSeeding(int object);

int FireEnableSeeding(int object);

int FireSetStrength(int object, int strength);

int FireRemoveObject(int object);

int FireUpdate();

int FireStop();

Call FireAddObject (in the player enters room) with an object number, a seed sprite number, and a palette sprite number, e.g.

FireAddObject(OBJECT_TORCH, GetObjectGraphic(OBJECT_TORCH), SPRITE_FIREPALETTE);

The seed sprite should be black or transparent where there is no flammable material, and white or grey where flames should start. It should also be tall and wide enough to encompass any flames, or they might get cut off. You may have to play with the sprite a bit to get the effect you want.

The palette sprite should be a 256x1 bitmap with the same colour depth as the seed. Pure magenta is transparent. Here's an example (it's in the zip file):

Call FireDisableSeeding to turn off flame generation but still allow the existing flames to burn up. Call FireEnableSeeding to turn the flame generation back on. Call FireSetStrength, passing a value between 0 and 100 for the strength of the flames, to adjust the flame height - so for a fire to burn out slowly, gradually reduce its strength, then disable the seeding.

Call FireUpdate in the room's repeatedly_execute_always. You might also want to call it a few times in the room's before fade in function to get the flames going. Alternatively call FirePreHeat on each object.

Call FireRemoveObject (for one) or FireStop (for all) to stop the flames. FireStop is called automatically when the player leaves the room or the game is quit.

The plugin has been tested in all bit depths and seems to work fine. Let me know if there are any problems.

Have fun!

SteveMcCrea

stevemccrea@gmail.com

5 June 2005